<%@ page import="java.util.List"%>
<%@ page import="com.pension.model.dto.Room"%>
<%@ page import="java.util.ArrayList"%>
<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>

<!DOCTYPE html>

<html>
<head>
<meta charset="utf-8" />
<title></title>
<link rel="Stylesheet" href="/pension/styles/default.css" />
<link rel="Stylesheet" href="/pension/styles/room/admin.css" />
<link rel="Stylesheet" href="/pension/styles/room/btfont.css" />

<script type='text/javascript'>
var selectedRoomNumber = -1;
function setCurrentRoom(roomNumber) {
	selectedRoomNumber = roomNumber;
}
function doDelete(boardno) {
	var ok = confirm("게시물을 삭제 합니다.");
	if (ok) {
		//삭제 처리
		location.href="/pension/room/delete.action?roomnumber=" + roomnumber;
	}
}

function doEdit(type) {
	if (selectedRoomNumber == -1) {
		alert('수정 또는 삭제할 방을 선택하세요 !!!');
		return;
	}
	
	if (type == 'update') {
		location.href = '/pension/room/editform.action?roomnumber=' + selectedRoomNumber;
	} else if (type == 'delete') {
		location.href = '/pension/room/delete.action?roomnumber=' + selectedRoomNumber;
	}
}
</script>
</head>
<body>
	<div id="pageContainer">

		<%
			pageContext.include("/WEB-INF/views/include/header.jsp");
		%>
		<br />

		<div id="content">
			<br /> <br />

			<table border="1" align="center" width="700px">
				<tr style="height: 30px; background-color: #4B4B4B; text-align: center; font-weight: bold;">
					<td></td>
					<td>호수</td>
					<td>이름</td>
					<td>타입</td>
					<td>최대인원</td>
					<td>크기</td>
					<td>가격</td>
				</tr>
				<%
					List<Room> rooms = (List<Room>) request.getAttribute("rooms");
				%>
				<%
					for (Room room : rooms) {
				%>
				<tr style="height: 30px; text-align: center; background-color:#808080;">
					<td><input type="radio" onclick="setCurrentRoom(<%= room.getRoomNumber() %>);" name="roomnumber" value="<%=room.getRoomNumber()%>"></input></td>
					<td><%=room.getRoomNumber()%></td>
					<td><a
						href='/pension/room/view.action?roomname=<%=room.getRoomName()%>' style='text-decoration: none; color: #333333'>
							<%=room.getRoomName()%>
					</a></td>
					<td><%=room.getRoomType()%></td>
					<td><%=room.getMaxPeople()%></td>
					<td><%=room.getAcreageSize()%>평</td>
					<td><%=room.getPriceRoom()%></td>
				</tr>
				<%
					}
				%>
				<p style="margin-left: 340px"> ※ 이름 클릭으로 상세보기 </p>
			</table>
			<br /> 
			<br />
		<br />
		<br />
		<table align="center" width="500px" border="0" cellpadding="0"
			cellspacing="0">
			<tr align="center">
				<td><a class="large awesome" href="/pension/room/registerform.action">
				&nbsp;&nbsp;&nbsp;ADD&nbsp;&nbsp;&nbsp;
				</a></td>
				<td><a class="large awesome"
					href="javascript:doEdit('update');">
					&nbsp;&nbsp;&nbsp;EDIT&nbsp;&nbsp;&nbsp;
					</a></td>
				<td><a class="large awesome" href="javascript:doEdit('delete');">DELETE</a></td>

			</tr>
		</table>
		<br />
		<br />
		<br />
		<table align="center" width="500px" border="0" cellpadding="0"
			cellspacing="0">
			<tr align="center">
				<td><a class="large awesome" href="/pension/member/adminsetting.action">ADMIN</a></td>
			</tr>
		</table>

</body>
</html>









